package BO;

import DB.UserDB;


public class User {
	private int userId;
	private String username;
	private int rank; //TODO Enum
	private String address;
	private String zipcode;
	private String city;
	private String email;
	private String firstname;
	private String surname;
	
	protected User(int userId, String username, int rank, String address, String zipcode, String city, String email, String firstname, String surname){
		this.userId = userId;
		this.username = username;
		this.rank = rank;
		this.address = address;
		this.zipcode = zipcode;
		this.city = city;
		this.email = email;
		this.firstname = firstname;
		this.surname = surname;
	}

	public int getUserId() {
		return userId;
	}

	public String getUsername() {
		return username;
	}

	public int getRank() {
		return rank;
	}

	public String getAddress() {
		return address;
	}

	public String getZipcode() {
		return zipcode;
	}
	
	public String getCity() {
		return city;
	}
	
	public String getEmail(){
		return email;
	}

	public String getFirstname() {
		return firstname;
	}

	public String getSurname() {
		return surname;
	}

	@Override
	public String toString() {
		return "User [userId=" + userId + ", username=" + username + ", rank="
				+ rank + ", address=" + address + ", zipcode=" + zipcode
				+ ", city=" + city + ", email=" + email + ", firstname="
				+ firstname + ", surname=" + surname + "]";
	}


	public static User login(String username, String password){
		return UserDB.login(username, password);
	}

	public static void editUser(int id, String username, int rank, String address, String zipcode, String city, String email, String firstname, String surname){
		UserDB.editUser(id, username, rank, address, zipcode, city, email, firstname, surname);
	}
	
	public static User getUserByUsername(String username){
		return UserDB.getUserByUsername(username);
	}
	
	public static boolean createUser(String username,String password, int rank, String address, String zipcode, String city, String firstname, String surname, String email){
		return UserDB.createUser(username,password,rank,address,zipcode,city,firstname,surname,email);
	}
}
